﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ec_System.API;
using Ec_System.Bll.Web;

namespace Ec_System.Cache.Web
{
    public class SiteConfigCache
    {
        SiteConfigManager siteConfigMangaer = new SiteConfigManager();
        /// <summary>
        /// 从缓冲中读取站点配置表的valueStr值
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public string GetSiteConfigByKey(string key)
        {
            
            string valueStr = RedisHelper.Get<string>("C" + key);
       
            if(valueStr == null)
            {
                valueStr = siteConfigMangaer.GetSiteConfigByKey(key);
                RedisHelper.Set<string>("C" + key, valueStr, 30);
            }

            return valueStr;
            
            //为了方便暂时不跑缓存
            //return siteConfigMangaer.GetSiteConfigByKey(key);
        }
    }
}
